import { createRouter, createWebHashHistory } from 'vue-router'

import Home from './views/Home.vue'
import About from './views/About.vue'
import HomeA from './views/HomeA.vue'
import HomeB from './views/HomeB.vue'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/home',
      component: Home,
      children: [
        // 子路由的 path 路径，不要以 / 开头
        // 要匹配上这条子路由，url 路径需要以 / 拼接 父路由的 path
        {
          path: 'a',
          component: HomeA,
        },
        {
          path: 'b',
          component: HomeB
        }
      ]
    },
    {
      path: '/about',
      component: About
    }
  ]
})


export default router